<html>
<head><meta charset="utf-8"><title>jit support · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/jit.20support.html">jit support</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="203698319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/jit%20support/near/203698319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/jit.20support.html#203698319">(Jul 13 2020 at 10:21)</a>:</h4>
<p>rustc_codegen_cranelift has support for jitting rust code. Unfortunately it is not possible to use this with cargo. There are two problems: First off all dependencies must be available as dylib either directly or included in the dylib of another dependency. Second problem is that rustc doesn't have a way to pass the fact that the executable must be jitted. For this reason I use an env var (CG_CLIF_JIT), however that env var also gets passed to build scripts, so cargo will not find the build script executables, as they were jitted.</p>
<p>The first problem could be solved by either somehow forcing all dependencies to be build as dylibs or cargo could make a dylib crate that depends on all dependencies of the executable and then pass that crate as extra dependency to the executable. The second problem could be solved by either unsetting <code>CG_CLIF_JIT</code> for build scripts or just jitting the build script and not try to call it afterwards.</p>
<p>How hard would those changes be? And would a PR for this be accepted at all?</p>



<a name="203731360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/jit%20support/near/203731360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/jit.20support.html#203731360">(Jul 13 2020 at 15:42)</a>:</h4>
<p>I don't know how hard it would be to impl. But I'd be ok to having a -Z flag for you to start experimenting!</p>



<a name="204191012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/jit%20support/near/204191012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/jit.20support.html#204191012">(Jul 17 2020 at 10:28)</a>:</h4>
<p>I think there is already an open issue asking to have the <code>build.rs</code> have a separate env/do not take in <code>RUSTFLAGS</code>, the workaround for it is to always pass <code>--target</code>, it seems an expansion on that.</p>



<a name="221229758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/jit%20support/near/221229758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/jit.20support.html#221229758">(Dec 30 2020 at 17:26)</a>:</h4>
<p>This would also be useful for miri: <a href="https://github.com/rust-lang/miri/issues/1661">rust-lang/miri#1661</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>